//
//  GWTitleView.m
//  网易新闻
//
//  Created by qianfeng on 16/2/28.
//  Copyright (c) 2016年 高炜. All rights reserved.
//

#import "GWTitleView.h"

@implementation GWTitleView
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self =[super initWithFrame:frame]) {
        self.userInteractionEnabled =NO;
        [self setImage:[UIImage imageNamed:@"navbar_netease"] forState:UIControlStateNormal];
        [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        self.titleLabel.font =[UIFont boldSystemFontOfSize:22];
        self.titleEdgeInsets =UIEdgeInsetsMake(0, 5, 0, 0);
        self.height =self.currentImage.size.height;
    }
    return self;
}
-(void)setTitle:(NSString *)title
{
    _title =title;
    [self setTitle:title forState:UIControlStateNormal];
    self.width =[title boundingRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:self.titleLabel.font} context:nil].size.width+self.titleEdgeInsets.left+self.currentImage.size.width;
}

@end
